package com.qiezikaka.kaka;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.os.Environment;

import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;

import com.bumptech.glide.request.target.ViewTarget;
import com.qiezikaka.kaka.utils.CustomExceptionHandler;


public class AppApplication extends MultiDexApplication{
    private static final String TAG = "AppApplication";
    private static AppApplication mContext;

    private ObjectAnimator mRotation;
    private ObjectAnimator mAlpha;

    @Override
    public void onCreate() {
        super.onCreate();
        this.mContext = this;
        //初始化信息管理类s
//        DataManager.getInstance().initService();
        String path = getExternalFilesDir(null).getAbsolutePath();
        Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(path,this));
        init();

    }

    public void init(){


    }



    public static Context getAppContext() {
        return mContext;
    }


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    public static String getDiskCacheDir() {
        String cachePath = null;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                || !Environment.isExternalStorageRemovable()) {
            cachePath = mContext.getExternalCacheDir().getPath();
        } else {
            cachePath = mContext.getCacheDir().getPath();
        }
        return cachePath;
    }

}
